package com.lineage.data.npc.other;

import com.lineage.data.executor.NpcExecutor;
import com.lineage.server.model.Instance.L1NpcInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.S_ShopBuyList;
import com.lineage.server.serverpackets.S_ShopSellList;
import com.lineage.server.serverpackets.ServerBasePacket;
import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class Npc_Philip extends NpcExecutor {
  private static final Log _log = LogFactory.getLog(Npc_Philip.class);
  
  private static Random _random = new Random();
  
  public static NpcExecutor get() {
    return new Npc_Philip();
  }
  
  public int type() {
    return 19;
  }
  
  public void talk(L1PcInstance pc, L1NpcInstance npc) {
    if (pc.getLawful() < 0) {
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "philip2"));
    } else {
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "philip1"));
    } 
  }
  
  public void action(L1PcInstance pc, L1NpcInstance npc, String cmd, long amount) {
    if (cmd.equalsIgnoreCase("buy")) {
      pc.sendPackets((ServerBasePacket)new S_ShopSellList(npc.getId()));
    } else if (cmd.equalsIgnoreCase("sell")) {
      pc.sendPackets((ServerBasePacket)new S_ShopBuyList(npc.getId(), pc));
    } 
  }
}
